package com.depay.mapper.model;

import java.math.BigInteger;
import java.sql.Timestamp;
import java.util.Date;
import java.util.Objects;

/**
 * @author xieyueshu 2019/1/31
 */
public class GoldTransaction {

	private long gameId;
	private String address;
	private String txHash;
	private Timestamp txTime;
	private long blockNumber;
	private String blockHash;
	private Timestamp blockTime;
    private int type;
    private int category;
    private BigInteger amount;
	private long rate;
    private BigInteger amountOf;
    private Timestamp addtime;
    private Timestamp updatetime;

    public GoldTransaction() {}

    private GoldTransaction(Builder builder) {
        setGameId(builder.gameId);
        setAddress(builder.address);
        setTxHash(builder.txHash);
        setTxTime(builder.txTime);
        setBlockNumber(builder.blockNumber);
        setBlockHash(builder.blockHash);
        setBlockTime(builder.blockTime);
        setType(builder.type);
        setCategory(builder.category);
        setAmount(builder.amount);
        setRate(builder.rate);
        setAmountOf(builder.amountOf);
    }


	public long getGameId() {
		return gameId;
	}

	public void setGameId(long gameId) {
		this.gameId = gameId;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getTxHash() {
		return txHash;
	}

	public void setTxHash(String txHash) {
		this.txHash = txHash;
	}

	public Timestamp getTxTime() {
		return txTime;
	}

	public void setTxTime(Timestamp txTime) {
		this.txTime = txTime;
	}

	public long getBlockNumber() {
		return blockNumber;
	}

	public void setBlockNumber(long blockNumber) {
		this.blockNumber = blockNumber;
	}

	public String getBlockHash() {
		return blockHash;
	}

	public void setBlockHash(String blockHash) {
		this.blockHash = blockHash;
	}

	public Timestamp getBlockTime() {
		return blockTime;
	}

	public void setBlockTime(Timestamp blockTime) {
		this.blockTime = blockTime;
	}

	public int getType() {
		return type;
	}

	public void setType(int type) {
		this.type = type;
	}

	public int getCategory() {
		return category;
	}

	public void setCategory(int category) {
		this.category = category;
	}

	public BigInteger getAmount() {
		return amount;
	}

	public void setAmount(BigInteger amount) {
		this.amount = amount;
	}

	public long getRate() {
		return rate;
	}

	public void setRate(long rate) {
		this.rate = rate;
	}

	public BigInteger getAmountOf() {
		return amountOf;
	}

	public void setAmountOf(BigInteger amountOf) {
		this.amountOf = amountOf;
	}

	public Timestamp getAddtime() {
		return addtime;
	}

	public void setAddtime(Timestamp addtime) {
		this.addtime = addtime;
	}

	public Timestamp getUpdatetime() {
		return updatetime;
	}

	public void setUpdatetime(Timestamp updatetime) {
		this.updatetime = updatetime;
	}

	@Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        GoldTransaction account = (GoldTransaction) o;
        return Objects.equals(txHash, account.txHash);
    }

    @Override
    public int hashCode() {

        return Objects.hash(txHash);
    }

    public static final class Builder {

    	private long gameId;
    	private String address;
    	private String txHash;
    	private Timestamp txTime;
    	private long blockNumber;
    	private String blockHash;
    	private Timestamp blockTime;
        private int type;
        private int category;
        private BigInteger amount;
    	private long rate;
        private BigInteger amountOf;

    	public Builder() {
        }
    	
        public Builder gameId(long val) {
        	gameId = val;
            return this;
        }
    	
        public Builder address(String val) {
        	address = val;
            return this;
        }
    	
        public Builder txHash(String val) {
        	txHash = val;
            return this;
        }
    	
        public Builder txTime(Timestamp val) {
        	txTime = val;
            return this;
        }
    	
        public Builder blockNumber(long val) {
        	blockNumber = val;
            return this;
        }
    	
        public Builder blockHash(String val) {
        	blockHash = val;
            return this;
        }
    	
        public Builder blockTime(Timestamp val) {
        	blockTime = val;
            return this;
        }
    	
        public Builder type(int val) {
        	type = val;
            return this;
        }
    	
        public Builder category(int val) {
        	category = val;
            return this;
        }
    	
        public Builder amount(BigInteger val) {
        	amount = val==null?BigInteger.ZERO:val;
            return this;
        }
    	
        public Builder rate(long val) {
        	rate = val;
            return this;
        }
    	
        public Builder amountOf(BigInteger val) {
        	amountOf = val==null?BigInteger.ZERO:val;
            return this;
        }
    	        
        public GoldTransaction build() {
            return new GoldTransaction(this);
        }
    }
}
